
***************BEGIN COMPUTING MOMENTS***************
use "$temp/nlsy_moment_data", clear
tab coll_cat
drop if hgc_20<12 //drop hs dropouts
drop if coll_cat == . //drop if educational category missing
drop if hgc_final == . //drop if final schooling missing

//subsume categories 2 and 5 into LQ private:
replace coll_cat = 5 if coll_cat == 2
replace coll_cat = coll_cat - 1 if coll_cat>1
tab coll_cat
tab coll_cat [w = weight_17]

tab coll_cat [w = weight_17]


****college attendance decisions****

qui{
    //decisions over abiltiy
	cap log close
	cap log using "$output/attendance_tabulations", replace
	
	//ability
	forval i = 1/3{
	    noi di "Ability level: `i'"
		noi tab coll_cat [w = weight_17] if ability == `i'
		noi di ""
	}

	//income/house quartile
	forval i = 1/4{
	    noi di "Parent Inc Quart: `i'"
		noi tab coll_cat [w = weight_17] if parent_inc_quart == `i'
		noi di ""
		
		noi di "Parent House Quart: `i'"
		noi tab coll_cat [w = weight_17] if parent_house_quart == `i'
		noi di ""
	}
	
	//ability AND income/house quartile
	forval i = 1/3{
	    forval j = 1/4{
		    noi di "Ability: `i'. Parent Inc Quart: `j'"
			noi tab coll_cat [w = weight_17] if parent_inc_quart == `j' & ability == `i'
			noi di ""
			
			noi di "Ability: `i'. Parent House Quart: `j'"
			noi tab coll_cat [w = weight_17] if parent_house_quart == `j' & ability == `i'
			noi di ""
		}
	}
	cap log close
}

//how often do people attend public comm colleges/universities in-state?
cap log using "$output/instate_attendance", replace
gen home_stfips = stfips_17
gen same_state = (home_stfips == coll_stfips)
su same_state [w = weight_17] if coll_stfips !=. & coll_cat == 1
su same_state [w = weight_17] if coll_stfips !=. & coll_cat == 2
cap log close

//educational attainment transitions by ability and college selection
cap log using "$output/educ_completion", replace
tab coll_cat hgc_final_comp [w = weight_17] if ability == 1, row
tab coll_cat hgc_final_comp [w = weight_17] if ability == 2, row
tab coll_cat hgc_final_comp [w = weight_17] if ability == 3, row
cap log close



//end of dofile
